using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class SO_facatMap : EntityTypeConfiguration<SO_facat>
    {
        public SO_facatMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Category, t.Life_Months_, t.Depreciation_Account, t.Dpreciation_Expense });

            // Properties
            this.Property(t => t.Category)
                .IsRequired()
                .HasMaxLength(20);

            this.Property(t => t.Life_Months_)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.Method)
                .HasMaxLength(19);

            this.Property(t => t.Depreciation_Account)
                .IsRequired()
                .HasMaxLength(40);

            this.Property(t => t.Dpreciation_Expense)
                .IsRequired()
                .HasMaxLength(40);

            // Table & Column Mappings
            this.ToTable("SO_facat");
            this.Property(t => t.Category).HasColumnName("Category");
            this.Property(t => t.Life_Months_).HasColumnName("Life(Months)");
            this.Property(t => t.Method).HasColumnName("Method");
            this.Property(t => t.Depreciation_Account).HasColumnName("Depreciation_Account");
            this.Property(t => t.Dpreciation_Expense).HasColumnName("Dpreciation_Expense");
        }
    }
}
